/*
 * -------------------------------------- 
 * FileName: mono_list.h 
 * Content:
 *      mono-way linked list
 * Auther:  杨则瑞 
 * Encode:  utf-8 | CRLF                  
 * -------------------------------------- 
 */



#ifndef _mono_list
#define _mono_list

#include<stdint.h>
#include<malloc.h>
#include<string.h>
#include<stddef.h>


#define ns(title) monoList_##title

typedef struct ns(node_t)  
{
    struct ns(node_t) *next;
    int data[0];

} ns(node_t);


typedef struct ns(t)
{
    struct ns(node_t) *_header;
    int _elem_size;
    
} ns(t);

// Memory
int ns(init)   (ns(t) * self, size_t elem_size);
int ns(uninit) (ns(t) * self);

// Modification
int ns(insert) (ns(t) * self, size_t pos,const void * element);
int ns(erase)  (ns(t) * self, size_t pos);
int ns(clear)  (ns(t) * self);

// Utility
int    ns(is_empty) (const ns(t) * self);
size_t ns(length)   (const ns(t) * self);
int    ns(get)      (const ns(t) * self, size_t pos, void * val_dest);



#undef ns 

#endif
